package com.sina.weibo;

import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import java.io.File;
import sudroid.android.FileUtil;

public class ImageViewerDialog extends AlertDialog
{
  private Context context;
  private File downloadedImage;
  private boolean finishPicLoad;
  private LayoutInflater inflater;
  private boolean isRedirectBlog;
  private ImageView iv;
  private LinearLayout layout;
  private AsyncTask<Void, Void, Uri> loadPicTask;
  public boolean loadPictureRunning;
  private LoadPictureTask mldPicTsk;
  private ProgressBar pb;
  String picfilePath;
  private String uri;

  public ImageViewerDialog(Context paramContext, String paramString)
  {
    super(paramContext);
    this.context = paramContext;
    LayoutInflater localLayoutInflater = LayoutInflater.from(paramContext);
    this.inflater = localLayoutInflater;
    LinearLayout localLinearLayout = (LinearLayout)this.inflater.inflate(2130903056, null);
    this.layout = localLinearLayout;
    ImageView localImageView1 = (ImageView)this.layout.findViewById(2131624014);
    this.iv = localImageView1;
    ImageView localImageView2 = this.iv;
    ImageViewerDialog.1 local1 = new ImageViewerDialog.1(this);
    localImageView2.setOnClickListener(local1);
    ProgressBar localProgressBar = (ProgressBar)this.layout.findViewById(2131624019);
    this.pb = localProgressBar;
    this.uri = paramString;
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    LinearLayout localLinearLayout = this.layout;
    setContentView(localLinearLayout);
    LoadPictureTask localLoadPictureTask = new LoadPictureTask(null);
    Object[] arrayOfObject = new Object[0];
    AsyncTask localAsyncTask = localLoadPictureTask.execute(arrayOfObject);
  }

  class LoadPictureTask extends AsyncTask<Object, Void, Object[]>
  {
    private LoadPictureTask()
    {
    }

    protected Object[] doInBackground(Object[] paramArrayOfObject)
    {
      try
      {
        RPCHelper localRPCHelper = RPCHelper.getInstance(ImageViewerDialog.this.context);
        String str1 = ImageViewerDialog.this.uri;
        String str2 = ImageViewerDialog.this.context.getCacheDir().getAbsolutePath();
        String str3 = localRPCHelper.getPicture(str1, str2, 1);
        ImageViewerDialog localImageViewerDialog = ImageViewerDialog.this;
        File localFile = new File(str3);
        localImageViewerDialog.downloadedImage = localFile;
        if (FileUtil.doesExisted(ImageViewerDialog.this.downloadedImage))
        {
          BitmapFactory.Options localOptions = new BitmapFactory.Options();
          localOptions.inJustDecodeBounds = 0;
          Bitmap.Config localConfig = Bitmap.Config.ARGB_4444;
          localOptions.inPreferredConfig = localConfig;
          localBitmap = BitmapFactory.decodeFile(ImageViewerDialog.this.downloadedImage.getAbsolutePath(), localOptions);
          if (localBitmap == null)
            boolean bool = FileUtil.deleteDependon(ImageViewerDialog.this.downloadedImage);
        }
        else
        {
          for (arrayOfObject = null; ; arrayOfObject = null)
            return arrayOfObject;
        }
      }
      catch (Exception localException)
      {
        while (true)
        {
          Bitmap localBitmap;
          Object[] arrayOfObject = null;
          continue;
          arrayOfObject = new Object[1];
          arrayOfObject[0] = localBitmap;
        }
      }
    }

    protected void onPostExecute(Object[] paramArrayOfObject)
    {
      ImageViewerDialog.this.loadPictureRunning = 0;
      if ((paramArrayOfObject != null) && (paramArrayOfObject[0] != 0))
      {
        ImageViewerDialog.this.pb.setVisibility(8);
        ImageView localImageView = ImageViewerDialog.this.iv;
        Bitmap localBitmap = (Bitmap)paramArrayOfObject[0];
        localImageView.setImageBitmap(localBitmap);
        ImageViewerDialog.this.finishPicLoad = 1;
      }
    }

    protected void onPreExecute()
    {
      super.onPreExecute();
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     com.sina.weibo.ImageViewerDialog
 * JD-Core Version:    0.6.0
 */